<!DOCTYPE html >
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>thymeleaf</title>
</head>
<script src="https://cdn.bootcss.com/jquery/3.5.0/jquery.js"></script>

<body>
<div id="ids">ajax</div>
判断map中是否包含某个值:
<div style="color: red" th:text="${map!=null?(#maps.containsKey(map,'name')?map.name:''):''}"></div>
<!--<div style="color: red" th:text="${map!=null?(#maps.containsKsy(map,name))?map.name:'':''}"> map为空测试</div>-->
<br>
<div th:text="${isNull}">字符串为空</div>
<br>
<div th:text="${#numbers.formatDecimal(num,3,2)}">金额</div>
<br>
<h1>测试</h1>
<!-- 单引号 和域中的值 -->
[[${name}]]
<br/>
<a th:href="'javascript:a(\''+${name}+'\')'">点击|JS中传递域中的函数|测试</a>
<br>
<p th:text="${hello}">默认值</p>
<h4>判断</h4>
<p th:if="1==2">我是存在的</p>
<br>
<input type="checkbox" th:checked="(${isOk})=='1'">

<!-- 取值 -->
<p th:text="${name}">name默认值</p>
<br>
<h4>循环</h4>
<p th:each="str: ${list} " th:text="${str}"></p>

<p th:each="str:${list}">
    <input type="text" th:value="${str}">
<div th:text="${str}"></div>
</p>
</body>
<script src="https://cdn.bootcss.com/jquery/3.5.0/jquery.js"></script>
<script>
    /* thymeleaf 中使用js https://www.cnblogs.com/huanghongbo/p/8947477.html */
    var message = '[[${name}]]';
    console.log(message);

    function a(msg) {
        alert(msg)
        console.log("点击了")
    }

    $(function () {
        //请求参数
        $.ajax({
            //请求方式
            type: "POST",
            //请求的媒体类型
            contentType: "application/json;charset=UTF-8",
            //请求地址
            url: "/hello",
            //数据，json字符串
            // data : JSON.stringify(list),
            //请求成功
            success: function (result) {
                console.log(result);
            },
            //请求失败，包含具体的错误信息
            error: function (e) {
                console.log(e.status);
                console.log(e.responseText);
            }
        });
    });


</script>

</html>